<script setup lang="ts">
import { useApplyStore } from '@/store'

const { stepsWithText, currentStep } = storeToRefs(useApplyStore())
function handleClickStep(index: number) {
  if (index - 1 < currentStep.value) {
    uni.navigateBack({
      delta: currentStep.value - index + 1,
    })
  }
}
</script>

<template>
  <div class="steps">
    <nut-steps :current="currentStep + 1" @click-step="handleClickStep" progress-dot>
      <nut-step v-for="(step, index) in stepsWithText" :key="index" :title="step.title">{{ index + 1 }}</nut-step>
    </nut-steps>
  </div>

</template>

<style lang="sass" scoped>
.steps
  padding: 15px 0
  background-color: #fff

:deep(.nut-step-main)
  margin-top: 20rpx
</style>
